home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / WE-BREAK.ZIP / WE-BREAK.POV < prev    next >
Encoding:
Text File  |  1997-02-28  |  31.8 KB  |  846 lines

  1.  
  2. //-------------------------------------------->
  3. //-------------------------------------------->
  4. //
  5. // "We Break The Glass"
  6. //
  7. // Created by: Paul T. Dawson
  8. //             ptdawson@voicenet.com
  9. //
  10. // February 28, 1997
  11. //
  12. // Released to the public domain - have fun with it!
  13. //
  14. //-------------------------------------------->
  15. //-------------------------------------------->
  16. // Global settings.
  17.  
  18.         #version 3.0
  19.         global_settings{ max_trace_level 20 }
  20.  
  21. //-------------------------------------------->
  22. //-------------------------------------------->
  23. // Scene switches - turn everything ON for final render!
  24.  
  25.         #declare Show_Awnings      = on
  26.         #declare Show_Club_Sign    = on
  27.         #declare Show_Door         = on
  28.         #declare Show_Dummies      = on
  29.         #declare Show_Fog          = on
  30.         #declare Show_Glass        = on
  31.         #declare Show_Misc         = on
  32.         #declare Show_Road         = on
  33.         #declare Show_Sidewalks    = on
  34.         #declare Show_Streetlights = on
  35.         #declare Show_Wall         = on
  36.         #declare Show_Windows      = on
  37.  
  38.         // If this is off, then one BRIGHT light is on!
  39.         #declare Final_Lights = on
  40.  
  41. //-------------------------------------------->
  42. //-------------------------------------------->
  43. // Include files and miscellaneous stuff.
  44.         
  45.         #include "colors.inc"
  46.         #include "textures.inc"
  47.         #include "metals.inc"
  48.         #include "stones.inc"
  49.         #include "woods.inc"
  50.         #include "glass.inc"
  51.  
  52.         #declare R = seed(0)
  53.         #declare P4_RAND = seed(0)
  54.  
  55.         #default { finish {
  56.                 diffuse 0.7 brilliance 0.4 crand 0.1 roughness 0.1 } }
  57.         
  58.         background { White }
  59.  
  60. //-------------------------------------------->
  61. //-------------------------------------------->
  62. // Camera.
  63.         
  64.         #declare CAMERA_LOC = < 15, 10, -40 >
  65.         
  66.         camera { location CAMERA_LOC look_at <32,5 ,0> }
  67.  
  68. //-------------------------------------------->
  69. //-------------------------------------------->
  70. // Lights.
  71.  
  72. // For testing, use one bright light at camera location.
  73.         
  74.         #if ( Final_Lights = off )
  75.  
  76.                 light_source { CAMERA_LOC color rgb 2 }
  77.  
  78.         #end // End of if block.
  79.  
  80. // Here are all the final lights.
  81.  
  82.         #if ( Final_Lights = on )
  83.  
  84.         // At camera location.
  85.         light_source { CAMERA_LOC color rgb 0.2 shadowless }
  86.         
  87.         // In middle of road, to create pothole shadows.
  88.         light_source { < -20, 1, -16 > color rgb 0.4 }
  89.         
  90.         // Under small awning.
  91.         light_source{<14,15,-1> color rgb 0.4 }
  92.         
  93.         // Behind second story windows.
  94.         light_source{<18,27,8> color rgb 0.3 }
  95.         light_source{<30,27,8> color rgb 0.3 }
  96.         light_source{<45,29,8> color rgb 0.3 }
  97.         light_source{<61,28,8> color rgb 1.0 }
  98.         
  99.         // Behind tall thin window.
  100.         light_source{<53,15,8> color rgb 0.5 }
  101.  
  102.         // Behind left side door.
  103.         light_source{<13,12,8> color rgb 1.0 }
  104.  
  105.         // Up behind big window.
  106.         light_source{<33,17,3> color rgb 0.8 }
  107.         
  108.         #end // End of if block.
  109.  
  110. //-------------------------------------------->
  111. //-------------------------------------------->
  112. // Two awnings.
  113.  
  114.         #if ( Show_Awnings = on )
  115.  
  116.         #declare Small_Awning = mesh {
  117.  
  118.                 #declare A = 0 #while ( A <= 160 )
  119.                 
  120.                 #declare VEC1 = < 0, 3, 0 >
  121.                 #declare VEC2 = vrotate ( <-5, 0, 0 >, < 0, -A, 0 > )
  122.                 #declare VEC3 = vrotate ( <-5, 0, 0 >, < 0, (-20-A), 0 > )
  123.                 #declare VEC4 = vrotate ( <-5, -1.5, 0 >, < 0, -A, 0 > )
  124.                 #declare VEC5 = vrotate ( <-5, -1.5, 0 >, < 0, (-20-A), 0 > )
  125.  
  126.                 triangle { VEC1, VEC2, VEC3 }
  127.                 triangle { VEC2, VEC3, VEC4 }
  128.                 triangle { VEC3, VEC4, VEC5 }
  129.                 
  130.                 #declare A = A + 20 #end
  131.  
  132.                 pigment { Gray20 }
  133.                 normal { crackle 2 scale < 0.1, 100, 0.1 > }
  134.                 
  135.                 } // End of mesh.
  136.  
  137.         object { Small_Awning translate < 14, 16, 0 > }
  138.  
  139.         #declare Start_Awning = box {
  140.                 < 0.001, 0.001, 0 > < 0.999, 0.999, 15 >
  141.                         pigment { image_map { gif "awning.gif"
  142.                                 interpolate 2 once } }
  143.                 scale < 26, 1, 1 > }
  144.  
  145.         #declare Sliced_Awning = difference {
  146.                 object { Start_Awning }
  147.                 #declare XX = 1 #while ( XX <= 25 )
  148.                         
  149.                         cylinder { < 0, 0, -0.1   > < 0, 0, 10.1 >, 1 
  150.                                 scale < 1.01, 0.3, 1 >
  151.                                 translate < XX, 1, 0 >
  152.                                 pigment { Gray30 } }
  153.  
  154.                 #declare XX = XX + 2 #end
  155.  
  156.                 rotate x * -20
  157.  
  158.                 normal { bumps 0.5 scale 2 }
  159.  
  160.                 } // End of difference.
  161.  
  162.         #declare Final_Awning = union {
  163.  
  164.         object{Sliced_Awning translate <21,16,-7>}
  165.  
  166.         // Poles.
  167.         cylinder {<21.75,8.5,0><21.75,16.5,-6>,0.15 pigment{Gray10}}
  168.         cylinder {<45.25,8.5,0><45.25,16.5,-6>,0.15 pigment{Gray10}}
  169.  
  170.         // Swivel things at bottom of poles.
  171.         cylinder { < 21.5, 8.5, 0 > < 22, 8.5, 0 >, 1 pigment{Black}}
  172.         cylinder { < 45.0, 8.5, 0 > < 45.5, 8.5, 0 >, 1 pigment{Black}}
  173.        
  174.         } // End of union.
  175.  
  176.         object { Final_Awning translate y*-1 }
  177.  
  178.         #end // End of if block.
  179.  
  180. //-------------------------------------------->
  181. //-------------------------------------------->
  182. // Club sign.
  183.  
  184.         #if ( Show_Club_Sign = on )
  185.         
  186.         #declare Club_Sign = union {
  187.  
  188.         box { < 0, 0, 0 > < 1, 1, 0.01 > 
  189.                 pigment{image_map { gif "a-club.gif" interpolate 2 once }}
  190.                 scale < 4, 1, 1 >
  191.                 finish{Shiny}
  192.                 normal { bumps 0.2 scale 0.3 }
  193.                 }
  194.         
  195.         cylinder{<0,1,0><4,1,0>, 0.05 texture{T_Silver_5E} }
  196.         cylinder{<0,0,0><4,0,0>, 0.05 texture{T_Silver_5E} }
  197.         cylinder{<0,0,0><0,1,0>, 0.05 texture{T_Silver_5E} }
  198.         cylinder{<4,0,0><4,1,0>, 0.05 texture{T_Silver_5E} }
  199.  
  200.         sphere{<0,0,0>,0.1  texture{T_Silver_5E} }
  201.         sphere{<0,1,0>,0.1  texture{T_Silver_5E} }
  202.         sphere{<4,1,0>,0.1  texture{T_Silver_5E} }
  203.         sphere{<4,0,0>,0.1  texture{T_Silver_5E} }
  204.  
  205.         } // End of union.
  206.  
  207.         object { Club_Sign scale<2.5,2,1> translate < 62, 15, -0.4 > }
  208.  
  209.         #end // End of if block.
  210.  
  211. //-------------------------------------------->
  212. //-------------------------------------------->
  213. // Left side door.
  214.  
  215.         #if ( Show_Door = on )
  216.  
  217.         #declare The_Door = union {
  218.  
  219.                 // Thirtysix panes of glass.
  220.                 #declare XX = 1 #while ( XX <= 6 )
  221.                 #declare YY = 7 #while ( YY <= 12 )
  222.                         box { < 0, 0, 0 > < 1, 1, 0.01 >
  223.                                 texture { T_Glass1 }
  224.                                 normal { bumps 1 scale 0.5
  225.                                         translate x * (rand(R)*1000) }
  226.                                 translate < XX, YY, 0.2 > }
  227.                 #declare YY = YY + 1 #end                
  228.                 #declare XX = XX + 1 #end
  229.                 
  230.                 // Wood pieces.
  231.                 // Left.
  232.                         box { < -0.1, -0.5, 0 > < 1, 14.1, 0.4 > }
  233.                 // Top.
  234.                         box { < 1, 13, 0 > < 7, 14.1, 0.4 > }
  235.                 // Right.
  236.                         box { < 7, 14.1, 0 > < 8.1, -0.5, 0.4 > }
  237.                 // Bottom.
  238.                         box { < 1, -0.5, 0 > < 7, 1, 0.4 > }
  239.                 // Center (directly under glass).
  240.                         box { < 1, 6, 0 > < 7, 7, 0.4 > }
  241.  
  242.                 // Threshold (of the door, not the antialiasing 8-)).
  243.                         box { < -0.1, -0.5, -0.7 > < 8.1, 0.1, 0.4 >
  244.                                 pigment { Gray20 }
  245.                                 normal { bumps 1 scale 0.5 } }
  246.  
  247.                 // Hand carved panel in lower part of door.
  248.                         height_field { gif "door.gif"
  249.                                 scale < 6, 0.3, 5 >
  250.                                 rotate x * -90
  251.                                 translate < 1, 1, 0.3 >
  252.                                 pigment { Gray70 }
  253.                         } // End of height_field.
  254.  
  255.                 // Door handle.
  256.                 torus { 1, 0.2
  257.                         rotate z * 90
  258.                         scale < 1, 1, 0.3 >
  259.                         translate < 7.5, 7, 0 >
  260.                         pigment { Black }
  261.                         finish { Shiny } }
  262.  
  263.                 // Vertical dividers.
  264.                 // (Too lazy to use a loop!).
  265.                 cylinder { < 1, 7, 0.2 > < 1, 13, 0.2 >, 0.1 pigment { Gray10 } }
  266.                 cylinder { < 2, 7, 0.2 > < 2, 13, 0.2 >, 0.1 pigment { Gray10 } }
  267.                 cylinder { < 3, 7, 0.2 > < 3, 13, 0.2 >, 0.1 pigment { Gray10 } }
  268.                 cylinder { < 4, 7, 0.2 > < 4, 13, 0.2 >, 0.1 pigment { Gray10 } }
  269.                 cylinder { < 5, 7, 0.2 > < 5, 13, 0.2 >, 0.1 pigment { Gray10 } }
  270.                 cylinder { < 6, 7, 0.2 > < 6, 13, 0.2 >, 0.1 pigment { Gray10 } }
  271.                 cylinder { < 7, 7, 0.2 > < 7, 13, 0.2 >, 0.1 pigment { Gray10 } }
  272.  
  273.                 // Horizontal dividers.
  274.                 // (Too lazy to use a loop!).
  275.                 cylinder { < 1,  7, 0.2 > < 7,  7, 0.2 >, 0.1 pigment { Gray10 } }
  276.                 cylinder { < 1,  8, 0.2 > < 7,  8, 0.2 >, 0.1 pigment { Gray10 } }
  277.                 cylinder { < 1,  9, 0.2 > < 7,  9, 0.2 >, 0.1 pigment { Gray10 } }
  278.                 cylinder { < 1, 10, 0.2 > < 7, 10, 0.2 >, 0.1 pigment { Gray10 } }
  279.                 cylinder { < 1, 11, 0.2 > < 7, 11, 0.2 >, 0.1 pigment { Gray10 } }
  280.                 cylinder { < 1, 12, 0.2 > < 7, 12, 0.2 >, 0.1 pigment { Gray10 } }
  281.                 cylinder { < 1, 13, 0.2 > < 7, 13, 0.2 >, 0.1 pigment { Gray10 } }
  282.  
  283.                 pigment { Gray30 }
  284.  
  285.                 normal { crackle 4 scale <0.5,100,0.5> turbulence 0.2 }
  286.                 
  287.                 } // End of union.
  288.  
  289.         object { The_Door translate < 10, 1, 0.9 > }
  290.  
  291.         #end // End of if block.
  292.  
  293. //-------------------------------------------->
  294. //-------------------------------------------->
  295. // The dummies.
  296.  
  297.         #if ( Show_Dummies = on )
  298.  
  299.         // Woman in window.
  300.         #include "p4def_01.inc"
  301.                 object { One_Person scale 0.18
  302.                         rotate y*-10 translate < 28, 4, 2 > }
  303.  
  304.         // Man climbing out of window.
  305.         #include "p4def_02.inc"
  306.                 object { One_Person scale 0.18
  307.                         rotate y*80 translate < 40, 1, -0.75 > }
  308.  
  309.         // Man going into a club.
  310.         #include "p4def_03.inc"
  311.                 object { One_Person scale 0.18
  312.                         rotate y*100 translate < 65, 1, -4 > }
  313.  
  314.         // Woman going into a club.
  315.         #include "p4def_04.inc"
  316.                 object { One_Person scale 0.18
  317.                         rotate y*-100 translate < 59, 1, -3 > }
  318.  
  319.         // Spray paint person.
  320.         #include "p4def_05.inc"
  321.                 object { One_Person scale 0.18
  322.                         rotate <-60,70,0> translate < 38.5, 0.1, -20 > }
  323.         
  324.         // Woman in center rear of window.
  325.         #include "p4def_06.inc"
  326.                 object { One_Person scale 0.18
  327.                         rotate <0,40,0> translate < 35, 4, 3.5 > }
  328.  
  329.         #end // End of if block.
  330.  
  331. //-------------------------------------------->
  332. //-------------------------------------------->
  333. // The fog.
  334.  
  335.         #if ( Show_Fog = on )
  336.  
  337.                 fog {   distance 1
  338.                         color rgbt < 0.25, 0.25, 0.30, 0.6 >
  339.                         fog_type 2
  340.                         fog_offset 0.1
  341.                         fog_alt 20
  342.                         turbulence 0.5
  343.  
  344.                 } // End of fog.
  345.  
  346.         #end // End of if block.
  347.  
  348. //-------------------------------------------->
  349. //-------------------------------------------->
  350. // The main section of broken glass.
  351.  
  352.         #if ( Show_Glass = on )
  353.  
  354.         #declare Glass_Section = polygon {
  355.  
  356.                 104,
  357.  
  358.                 < 0, 0 >
  359.                 < 0, 1 >
  360.  
  361.                 #declare A = 1 #while ( A <=99 )
  362.  
  363.                         < A, rand(R)+0.5 >
  364.  
  365.                 #declare A = A + 1 #end
  366.  
  367.                 < 100, 1 >
  368.                 < 100, 0 >
  369.                 <   0, 0 >
  370.                 
  371.                 } // End of polygon.
  372.  
  373.         union {
  374.  
  375.         // Top.
  376.         object { Glass_Section scale < 21/100, 1, 1 >
  377.                 rotate x*180 translate y * 12 }
  378.         
  379.         // Bottom.
  380.         object { Glass_Section scale < 21/100, 1, 1 > }
  381.         
  382.         // Left (pokes down through floor).
  383.         object { Glass_Section scale < 21/100, 1, 1 >
  384.                 rotate x*180 rotate z*90 translate y*-8 }
  385.         
  386.         // Right (pokes down through floor).
  387.         object { Glass_Section scale < 21/100, 1, 1 >
  388.                 rotate z*90 translate x*21 translate y*-8 }
  389.  
  390.         texture { T_Glass1 }
  391.         finish { ambient 0.7 }
  392.         translate < 23, 4, 0.1 >
  393.  
  394.         } // End of union.
  395.  
  396.         // Broken glass on sidewalk.
  397.  
  398.                 #declare A = 1 #while ( A <= 100 )
  399.  
  400.                         #declare X1 = (rand(R)*20) + 23
  401.                         #declare Y1 = 1.01
  402.                         #declare Z1 = (rand(R)*6) - 5
  403.  
  404.                         #declare X2 = X1 + (rand(R)*2) - 1
  405.                         #declare Y2 = 1.05
  406.                         #declare Z2 = Z1 + (rand(R)*2) - 1
  407.  
  408.                         #declare X3 = X2 + (rand(R)*2) - 1
  409.                         #declare Y3 = 1.10
  410.                         #declare Z3 = Z2 + (rand(R)*2) - 1
  411.  
  412.                         triangle { <X1,Y1,Z1><X2,Y2,Z2><X3,Y3,Z3>
  413.                                 texture { T_Chrome_5E }
  414.                                 finish { ambient 0.5 }
  415.                                 } // End of triangle.
  416.  
  417.                 #declare A = A + 1 #end
  418.         
  419.         #end // End of if block.
  420.  
  421. //-------------------------------------------->
  422. //-------------------------------------------->
  423. // Miscellaneous objects.
  424.  
  425.         #if ( Show_Misc = on )
  426.  
  427.         // Backdrop panel in big window.
  428.                 box { < 20, 0, 5 > < 50, 18, 5.1 > pigment{Gray60}}
  429.  
  430.         // Left side panel in big window.
  431.                 box { < 22.5, 0, 0.5 > < 22.6, 18, 6 > pigment{Gray60}}
  432.  
  433.         // Right side panel in big window.
  434.                 box { < 44.5, 0, 0.5 > < 44.6, 18, 6 > pigment{Gray60}}
  435.  
  436.         // Right side panel in club doorway.
  437.                 box { < 70.5, 0, 0.5 > < 70.6, 18, 6 > pigment{Gray30}}
  438.  
  439.         // Set up the back wall.
  440.                 box { < -200, -200, 15 > < 200, 200, 16 > pigment{White}}
  441.  
  442.         // This is the second-floor-floor and the first-floor-ceiling!
  443.                 box{<-20,19,0.1><100,19.1,20> pigment{White}}
  444.  
  445.         #end // End of if block.
  446.  
  447. //-------------------------------------------->
  448. //-------------------------------------------->
  449. // The road.
  450.  
  451.         #if ( Show_Road = on )
  452.  
  453.                 height_field { png "road.png"
  454.  
  455.                         pigment{image_map {
  456.                                 gif "paint.gif"
  457.                                 interpolate 2 } rotate x*90}
  458.  
  459.                         scale < 70, 0.3, 20 >
  460.                         translate < 0, -0.1, -26 >
  461.  
  462.                         normal { crackle 0.1 scale 0.1 turbulence 0.1 }
  463.  
  464.                         } // End of height_field.
  465.  
  466.                 // Here are the puddles in the road.
  467.                         box { < -10, -1, -5 > < 100, 0, -27 >
  468.                                 pigment{White}finish{Mirror}
  469.                                 normal { bumps 0.2 scale 0.4 }
  470.                                 } // End of box.
  471.  
  472.         #end // End of if block.
  473.  
  474. //-------------------------------------------->
  475. //-------------------------------------------->
  476. // The sidewalks.
  477.  
  478.         #if ( Show_Sidewalks = on )
  479.  
  480.         // This flips from 0 to 1 to 0, to offset the blocks.
  481.                 #declare OFFSET = 1
  482.  
  483.         #declare One_Block = superellipsoid { < 0.1, 0.1 >
  484.                 scale < 0.95, 0.5, 0.95 > }
  485.  
  486.         #declare XX = -10 #while ( XX <= 100 )
  487.  
  488.         #declare ZZ = -6 #while ( ZZ <= 6 )
  489.  
  490.                 #declare OFFSET = 1 - OFFSET
  491.                 
  492.                 object { One_Block
  493.                         
  494.                         // Add random wiggle.
  495.                         #declare WIGGLE = (rand(R)*6)-3
  496.                         rotate y * WIGGLE
  497.                         translate < XX+OFFSET+1, 0.5, ZZ+1 >
  498.                         
  499.                         #declare RGB = (rand(R)/10) + 0.35
  500.                         pigment { color rgb RGB }
  501.                         normal { crackle 0.3 scale 0.1 } }
  502.  
  503.         #declare ZZ = ZZ + 2 #end
  504.  
  505.         #declare ZZ = -36 #while ( ZZ <= -28 )
  506.                 
  507.                 #declare OFFSET = 1 - OFFSET
  508.  
  509.                 object { One_Block
  510.                 
  511.                         // Add random wiggle.
  512.                         #declare WIGGLE = (rand(R)*6)-3
  513.                         rotate y * WIGGLE
  514.                         translate < XX+OFFSET+1, 0.5, ZZ+1 >
  515.                 
  516.                         #declare RGB = (rand(R)/10) + 0.35
  517.                         pigment { color rgb RGB }
  518.                         normal { crackle 0.3 scale 0.1 } }
  519.  
  520.         #declare ZZ = ZZ + 2 #end
  521.  
  522.         #declare XX = XX + 2 #end
  523.  
  524.         // Put in the grout all at once.
  525.                 box { < -10, 0, -5.9 > < 100, 0.9, 8 >
  526.                         pigment { Gray20 }
  527.                         normal { crackle 4 scale 1 } }
  528.                 
  529.                 box { < -10, 0, -26.1 > < 100, 0.9, -36 >
  530.                         pigment { Gray20 }
  531.                         normal { crackle 4 scale 1 } }
  532.  
  533.         #end // End of if block.
  534.  
  535. //-------------------------------------------->
  536. //-------------------------------------------->
  537. // The streetlights.
  538.  
  539.         #if ( Show_Streetlights = on )
  540.  
  541.         #declare Street_Light = union {
  542.  
  543.                 // Base.
  544.                 cone { < 0,0,0>,1 <0,0.3,0>,0.8
  545.                         normal{crackle 1 scale 0.5 }
  546.                         pigment { Gray20 } }
  547.                 // Tall column.
  548.                 cone { < 0,0.3,0>,0.6 <0,12.5,0>,0.4
  549.                         normal{crackle 1 scale 0.5 }
  550.                         pigment { Gray40 } }
  551.                 // Under light.
  552.                 cone { < 0,12.5,0>,0.4 <0,13.2,0>,0.8
  553.                         normal{crackle 1 scale 0.5 }
  554.                         pigment { Gray20 } }
  555.                 // Over light.
  556.                 cone { < 0,15,0>,1.2 <0,15.2,0>,1.0
  557.                         normal{crackle 1 scale 0.5 }
  558.                         pigment { Gray20 } }
  559.                 // Very top.
  560.                 cone { < 0,15.2,0>,1.0 <0,15.5,0>,0.001
  561.                         normal{crackle 1 scale 0.5 }
  562.                         pigment { Gray20 } }
  563.  
  564.                 // Around glass part.
  565.                 #declare A = 0 #while ( A < 360 )
  566.                         cylinder { <0.7,13.2,0><0.9,15,0>,0.03
  567.                                 rotate y*A
  568.                                 normal { crackle 1 scale 0.5 }
  569.                                 pigment { Gray40 } }
  570.                 #declare A=A+30 #end
  571.  
  572.                 // Glass part.
  573.                 difference {
  574.                         cone { < 0, 13.200, 0>,0.700 <0,15.000,0>,0.900 }
  575.                         cone { < 0, 13.199, 0>,0.699 <0,15.001,0>,0.899 }
  576.                         texture { T_Glass1 }
  577.                 } // End of difference.
  578.  
  579.                 // Actual light inside it.
  580.                 light_source { < 0, 0, 0 > color rgb 1
  581.                         looks_like {
  582.                                 
  583.                                 // Two stretched spheres.
  584.                                 union {
  585.                                         sphere { 0, 0.2
  586.                                         scale < 1, 2, 1 >
  587.                                         translate <-0.2,0.3,0> }
  588.                                         sphere { 0, 0.2
  589.                                         scale < 1, 2, 1 >
  590.                                         translate <0.2,0.3,0> }
  591.                                 pigment { White * 8 }
  592.                                 finish { Shiny }
  593.                                 } // End of union.
  594.                                 } // End of looks_like.
  595.  
  596.                         translate y*14 } // End of light_source.
  597.                 
  598.                 } // End of union.
  599.  
  600.         object { Street_Light translate < 20, 1, -5 > }
  601.         object { Street_Light translate < 54, 1, -5 > }
  602.         
  603.         object { Street_Light translate < 35, 1, -30 > }
  604.  
  605.         #end // End of if block.
  606.  
  607. //-------------------------------------------->
  608. //-------------------------------------------->
  609. // Build some blocks for the wall.
  610.  
  611.         #if ( Show_Wall = on )
  612.  
  613.         // "^" is the top of a window/door.
  614.         #declare Tile_2 = box{<0,0,-0.3><1,1,2>
  615.                 pigment{Gray70}
  616.                 normal { crackle 0.5 scale 0.1 } } 
  617.         
  618.  
  619.         // "X" is the bottom of a window/door.
  620.         #declare Tile_3 = box{<0,0,-0.4><1,1,5>
  621.                 pigment{Gray40}
  622.                 normal { crackle 0.5 scale 0.1 } } 
  623.  
  624.         // "I" is the side of a window/door.
  625.         #declare Tile_4 = box { < 0, 0, -0.3 > < 1, 1, 1 >
  626.                 pigment{Gray50}
  627.                 normal { crackle 0.5 scale 0.1 } } 
  628.         
  629. //-------------------------------------------->
  630. //-------------------------------------------->
  631. // "@" is a solid double wide block.
  632.  
  633.         #declare V01 = < 0, 1, 0 >
  634.         #declare V02 = < 1, 1, 0 >
  635.         #declare V03 = < 2, 1, 0 >
  636.         #declare V04 = < 0.1, 0.9, -0.2 >
  637.         #declare V05 = < 1.9, 0.9, -0.2 >
  638.         #declare V06 = < 0, 0.5, 0 >
  639.         #declare V07 = < 1, 0.5, -0.25 >
  640.         #declare V08 = < 2, 0.5, 0 >
  641.         #declare V09 = < 0.1, 0.1, -0.2 >
  642.         #declare V10 = < 1.9, 0.1, -0.2 >
  643.         #declare V11 = < 0, 0, 0 >
  644.         #declare V12 = < 1, 0, 0 >
  645.         #declare V13 = < 2, 0, 0 >
  646.  
  647.         #declare Tile_1 = mesh {
  648.  
  649.         // Top.
  650.         triangle { V01, V02, V04 }
  651.         triangle { V02, V03, V05 }
  652.         triangle { V04, V02, V05 }
  653.         
  654.         // Right.
  655.         triangle { V03, V05, V08 }
  656.         triangle { V05, V08, V10 }
  657.         triangle { V08, V10, V13 }
  658.         
  659.         // Bottom.
  660.         triangle { V09, V12, V10 }
  661.         triangle { V09, V11, V12 }
  662.         triangle { V12, V10, V13 }
  663.         
  664.         // Left.
  665.         triangle { V01, V04, V06 }
  666.         triangle { V04, V06, V09 }
  667.         triangle { V06, V09, V11 }
  668.         
  669.         // Center.
  670.         triangle { V04, V05, V07 }
  671.         triangle { V04, V07, V09 }
  672.         triangle { V09, V07, V10 }
  673.         triangle { V05, V07, V10 }
  674.  
  675.         } // End of mesh.
  676.  
  677. //-------------------------------------------->
  678. //-------------------------------------------->
  679. // "H" is a half block..
  680.  
  681.         #declare V01 = < 0, 1, 0 >
  682.         #declare V02 = < 0.5, 1, 0 >
  683.         #declare V03 = < 1 1, 0 >
  684.         #declare V04 = < 0.1, 0.9, -0.2 >
  685.         #declare V05 = < 0.9, 0.9, -0.2 >
  686.         #declare V06 = < 0, 0.5, 0 >
  687.         #declare V07 = < 0.5, 0.5, -0.25 >
  688.         #declare V08 = < 1, 0.5, 0 >
  689.         #declare V09 = < 0.1, 0.1, -0.2 >
  690.         #declare V10 = < 0.9, 0.1, -0.2 >
  691.         #declare V11 = < 0, 0, 0 >
  692.         #declare V12 = < 0.5, 0, 0 >
  693.         #declare V13 = < 1, 0, 0 >
  694.  
  695.         #declare Tile_5 = mesh {
  696.  
  697.         // Top.
  698.         triangle { V01, V02, V04 }
  699.         triangle { V02, V03, V05 }
  700.         triangle { V04, V02, V05 }
  701.         
  702.         // Right.
  703.         triangle { V03, V05, V08 }
  704.         triangle { V05, V08, V10 }
  705.         triangle { V08, V10, V13 }
  706.         
  707.         // Bottom.
  708.         triangle { V09, V12, V10 }
  709.         triangle { V09, V11, V12 }
  710.         triangle { V12, V10, V13 }
  711.         
  712.         // Left.
  713.         triangle { V01, V04, V06 }
  714.         triangle { V04, V06, V09 }
  715.         triangle { V06, V09, V11 }
  716.         
  717.         // Center.
  718.         triangle { V04, V05, V07 }
  719.         triangle { V04, V07, V09 }
  720.         triangle { V09, V07, V10 }
  721.         triangle { V05, V07, V10 }
  722.         
  723.         } // End of mesh.
  724.  
  725. //-------------------------------------------->
  726. //-------------------------------------------->
  727. // Now put all the blocks together.
  728.  
  729.         union {
  730.  
  731.                 #declare YYY = 1 #while (YYY<=32)
  732.  
  733.                 #if(YYY=32)#declare STRING = ".@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@." #end
  734.                 #if(YYY=31)#declare STRING = "@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.^^^^^^^^^^^^@.@.@.@.@.@.@.@.@.@.@.@.@" #end
  735.                 #if(YYY=30)#declare STRING = ".@.@.@.@.@.@.H^^^^^^^^H@.^^^^^^^^@.@.H^^^^^^^^^^^^H@.@.@.@.@.@.@.@.@.@.@.@." #end
  736.                 #if(YYY=29)#declare STRING = "@.@.@.@.@.@.@.I......I@.HI......IH@.@.I..........I@.@.@.^^^^^^^^^H@.@.@.@.@" #end
  737.                 #if(YYY=28)#declare STRING = ".@.@.@.@.@.@.HI......IH@.I......I@.@.HI..........IH@.@.HI.......I@.@.@.@.@." #end
  738.                 #if(YYY=27)#declare STRING = "@.@.@.@.@.@.@.I......I@.HI......IH@.@.I..........I@.@.@.I.......IH@.@.@.@.@" #end
  739.                 #if(YYY=26)#declare STRING = ".@.@.@.@.@.@.HI......IH@.I......I@.@.HXXXXXXXXXXXXH@.@.HI.......I@.@.@.@.@." #end
  740.                 #if(YYY=25)#declare STRING = "@.@.@.@.@.@.@.I......I@.HI......IH@.@.@.@.@.@.@.@.@.@.@.I.......IH@.@.@.@.@" #end
  741.                 #if(YYY=24)#declare STRING = ".@.@.@.@.@.@.HI......IH@.I......I@.@.@.@.@.@.@.@.@.@.@.HI.......I@.@.@.@.@." #end
  742.                 #if(YYY=23)#declare STRING = "@.@.@.@.@.@.@.I......I@.HI......IH@.@.@.@.@.@.@.@.@.@.@.I.......IH@.@.@.@.@" #end
  743.                 #if(YYY=22)#declare STRING = ".@.@.@.@.@.@.HI......IH@.I......I@.@.@.@.@.@.@.@.@.@.@.HXXXXXXXXX@.@.@.@.@." #end
  744.                 #if(YYY=21)#declare STRING = "@.@.@.@.@.@.@.XXXXXXXX@.HXXXXXXXXH@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@" #end
  745.                 #if(YYY=20)#declare STRING = ".@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@." #end
  746.                 #if(YYY=19)#declare STRING = "@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@" #end
  747.                 #if(YYY=18)#declare STRING = ".@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.H^^^^^@.@.@.@.@.@.@.@.@.@." #end
  748.                 #if(YYY=17)#declare STRING = "@.@.@.@.@.@.@.@.@.@.H^^^^^^^^^^^^^^^^^^^^^^^@.@.@.I...IH@.@.@.@.@.@.@.@.@.@" #end
  749.                 #if(YYY=16)#declare STRING = ".@.@.@.@.@.@.@.@.@.@.^^^^^^^^^^^^^^^^^^^^^^^H@.@.HI...I@.@.@.@.@.@.@.@.@.@." #end
  750.                 #if(YYY=15)#declare STRING = "@.@.@.@.^^^^^^^^^^@.HI.....................I@.@.@.I...IH@.@.@.^^^^^^^^@.@.@" #end
  751.                 #if(YYY=14)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.HI...I@.@.@.H^^^^^^^^H@.@." #end
  752.                 #if(YYY=13)#declare STRING = "@.@.@.@.I........I@.HI.....................I@.@.@.I...IH@.@.@.I......I@.@.@" #end
  753.                 #if(YYY=12)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.HI...I@.@.@.HI......IH@.@." #end
  754.                 #if(YYY=11)#declare STRING = "@.@.@.@.I........I@.HI.....................I@.@.@.I...IH@.@.@.I......I@.@.@" #end
  755.                 #if(YYY=10)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.HI...I@.@.@.HI......IH@.@." #end
  756.                 #if(YYY= 9)#declare STRING = "@.@.@.@.I........I@.HI.....................I@.@.@.XXXXXH@.@.@.I......I@.@.@" #end
  757.                 #if(YYY= 8)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.@.@.@.@.@.@.HI......IH@.@." #end
  758.                 #if(YYY= 7)#declare STRING = "@.@.@.@.I........I@.HI.....................I@.@.@.@.@.@.@.@.@.I......I@.@.@" #end
  759.                 #if(YYY= 6)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.@.@.@.@.@.@.HI......IH@.@." #end
  760.                 #if(YYY= 5)#declare STRING = "@.@.@.@.I........I@.HI.....................I@.@.@.@.@.@.@.@.@.I......I@.@.@" #end
  761.                 #if(YYY= 4)#declare STRING = ".@.@.@.HI........IH@.I.....................IH@.@.@.@.@.@.@.@.HI......IH@.@." #end
  762.                 #if(YYY= 3)#declare STRING = "@.@.@.@.I........I@.HXXXXXXXXXXXXXXXXXXXXXXX@.@.@.@.@.@.@.@.@.I......I@.@.@" #end
  763.                 #if(YYY= 2)#declare STRING = ".@.@.@.HI........IH@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.HI......IH@.@." #end
  764.                 #if(YYY= 1)#declare STRING = "@.@.@.@.I........I@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.I......I@.@.@" #end
  765.  
  766.                 #declare XXX = 1 #while (XXX<=75)
  767.  
  768.                 #declare TEMPSTRING= substr( STRING, XXX, 1)
  769.         
  770.                 #declare Match_1 = strcmp ( TEMPSTRING,"@" )
  771.                 #declare Match_2 = strcmp ( TEMPSTRING,"^" )
  772.                 #declare Match_3 = strcmp ( TEMPSTRING,"X" )
  773.                 #declare Match_4 = strcmp ( TEMPSTRING,"I" )
  774.                 #declare Match_5 = strcmp ( TEMPSTRING,"H" )
  775.  
  776.                 #declare TEMP_TEX = texture { T_Stone16
  777.                 translate <rand(R)*100,rand(R)*100,rand(R)*100> }
  778.  
  779.                 #if ( Match_1 = 0 ) object{Tile_1 translate <XXX,YYY,0> texture { TEMP_TEX }} #end
  780.                 #if ( Match_2 = 0 ) object{Tile_2 translate <XXX,YYY,0> } #end
  781.                 #if ( Match_3 = 0 ) object{Tile_3 translate <XXX,YYY,0> } #end
  782.                 #if ( Match_4 = 0 ) object{Tile_4 translate <XXX,YYY,0> } #end
  783.                 #if ( Match_5 = 0 ) object{Tile_5 translate <XXX,YYY,0> texture { TEMP_TEX }} #end
  784.  
  785.                 #declare XXX=XXX+1 #end
  786.  
  787.                 #declare YYY=YYY+1 #end
  788.  
  789.                 normal { crackle 0.05 scale 0.05 }
  790.  
  791.         } // End of union.
  792.  
  793.         #end // End of if block.
  794.  
  795. //-------------------------------------------->
  796. //-------------------------------------------->
  797. // Windows (incredibly sloppy!).
  798.  
  799.         #if ( Show_Windows = on )
  800.  
  801.         // Vertical dividers.
  802.         #declare X = 15 #while ( X <= 66 )
  803.                 cylinder { < X, 20, 0.5 > < X, 31, 0.5 >, 0.1
  804.                         pigment { Gray10 } }
  805.         #declare X = X + 1 #end
  806.  
  807.         // Horizontal dividers.
  808.         #declare Y = 20 #while ( Y <= 31 )
  809.                 cylinder { < 15, Y, 0.5 > < 66, Y, 0.5 >, 0.1
  810.                         pigment { Gray10 } }
  811.         #declare Y = Y + 1 #end
  812.  
  813.         // Lots of individual panes of glass.
  814.  
  815.                 #declare XX = 15 #while ( XX <= 65 )
  816.                 #declare YY = 20 #while ( YY <= 30 )
  817.                         
  818.                         box { < 0, 0, 0 > < 1, 1, 0.001 >
  819.                                 texture { T_Glass1 }
  820.                                 normal { bumps 1 scale 0.5
  821.                                         translate x * (rand(R)*1000) }
  822.                                 translate < XX, YY, 0.5 > }
  823.                 #declare YY = YY + 1 #end                
  824.                 #declare XX = XX + 1 #end
  825.  
  826.         // Now do the tiny window, with diagonal dividers.
  827.                 #declare A = 3 #while ( A <= 17 )
  828.                         
  829.                         cylinder { <49,A,0.3><57,A+5,0.3>,0.1
  830.                                 pigment { Gray50 } }
  831.                         cylinder { <49,A+5,0.3><57,A,0.3>,0.1
  832.                                 pigment { Gray50 } }
  833.  
  834.                 #declare A = A + 1 #end
  835.                 
  836.                 box { < 50, 8, 0.3 > < 56, 19, 0.301 >
  837.                         texture { T_Glass1 }
  838.                                 normal { bumps 1 scale 0.5 } }
  839.  
  840.         #end // End of if block.
  841.  
  842. //-------------------------------------------->
  843. //-------------------------------------------->
  844. // Bye!
  845.  
  846.